<template>
  <div>
    <el-container class="s">
      <el-container>
        <el-aside width="200px" class="CD">
          <el-row class="tac">
            <el-col>
              <h5 class="mb-2">七尾TMS</h5>
              <el-menu
                default-active="2"
                class="el-menu-vertical-demo"
                @open="handleOpen"
                @close="handleClose"
              >
                <el-sub-menu index="1">
                  <template #title>
                    <el-icon>
                      <Menu />
                    </el-icon>
                    <span>工作台</span>
                  </template>
                  <el-menu-item index="1-1">
                    <el-icon>
                      <TrendCharts />
                    </el-icon>
                    工作台
                  </el-menu-item>
                </el-sub-menu>
              </el-menu>
            </el-col>
          </el-row>
        </el-aside>
        <el-main>Main</el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import { ref } from "vue";
import { useRouter } from "vue-router";
import { ElMessage } from 'element-plus';
import axios from "axios";

// import {
//     Document,
//     Menu as IconMenu,
//     Location,
//     Setting,
// } from '@element-plus/icons-vue'
export default {
  setup() {
    let name = ref("");
    let router = useRouter();
    function shouye() {

      axios({
        method: "get",
        url: "http://localhost:5131/api/Help/Helper",
        headers: {
          Authorization: "Bearer " + sessionStorage.getItem("token"),
        },
      }).then((res) => {
        console.log(res.data);
        if(res.data.code == -1){
          sessionStorage.setItem("token", '')
          ElMessage.error("异常错误!!!");
          router.push("/Login");
        }else{
          ElMessage.success("登录成功");
        }
      });

      
    }

    shouye();

    function handleOpen() {}

    function handleClose() {}

    return {
      shouye,
      name,
      router,
      handleOpen,
      handleClose,
    };
  },
};
</script>

<style scoped>
.el-footer {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #d3dce6;
  color: #333;
  text-align: center;
  /* line-height: 200px; */
}

.el-main {
  background-color: gray;
  color: #333;
  text-align: center;
  /* line-height: 160px; */
}

body > .el-container {
  margin-bottom: 40px;
}

.s {
  height: 100vh;
}
</style>
